package xpn.platform.modules.workflow.runtime.instance;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import xpn.platform.common.persistence.AbstractBaseEntity;
import xpn.platform.modules.workflow.definition.process.Process;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 * 流程实例：代表一个流程的执行实例。一个流程实例通常包含多个执行状态，至少有一个执行者。
 * 
 * @author bobatkm Sep 5, 2017
 *
 */

@Entity
@Table(name = "wf_ru_instance")
@Getter
@Setter
public class Instance extends AbstractBaseEntity {

	private static final long serialVersionUID = 896094785420263362L;

	@ManyToOne
	@JoinColumn(nullable = false)
	@NotNull
	private Process process;

	@Length(min = 1, max = 40)
	private String starterId; // 启动者

	private String parentInstanceId; // 父流程实例id

	private String parentInstanceEntityLink; // 父流程实例对应表单连接

	/**
	 * 流程定义对应的实体名
	 */
	private String entityName;
}
